#include <iostream>

#include "frame_paser.hpp"
// #include "frame_paser_invert_search.hpp"

int main() {
  FrameParser<std::uint8_t> parser{{ 0xa5, 0x5a }, { 0xb5, 0x5b }, false}; 
  std::vector<std::vector<std::uint8_t>> frames;

  parser.append({
    0x01, 0x02, 0x03, 0xb5, 0x5b
    , 0xa5, 0x5a, 0x04, 0x05, 0x06, 0x07, 0x07, 0xb5, 0x5b
    , 0xa5, 0x5a, 0x08, 0x09, 0x0a
  });
  parser.parse(frames);
  for (auto data : frames) {
    for (auto vv : data) {
        printf("0x%02x ", vv);
    }
    printf("\n");
  }
  printf("size  %ld \n ", frames.data()->size());
  frames.clear();

  parser.append({ 0x0b, 0xb5, 0x5b, 0xa5, 0x5a, 0x0c });
  parser.parse(frames);
  for (auto data : frames) {
    for (auto vv : data) {
        printf("0x%02x ", vv);
    }
    printf("\n");
  }
  printf("size  %ld \n ", frames.data()->size());
  frames.clear();

  parser.append({ 0x0b, 0xb5 });
  parser.parse(frames);
  for (auto data : frames) {
    for (auto vv : data) {
        printf("0x%02x ", vv);
    }
    printf("\n");
  }
  frames.clear();

  std::cout << "frames nums = " << frames.size() << std::endl;

  return 0;
}